<template>
    <div class="bi-list" >
        <bi-form>
            <bi-form-item label="驱动" >
                <bi-radio v-model="from" dir="column" :option="fromOption" />
            </bi-form-item>
            <bi-form-item label="自定义" v-if="from == '自定义'"  >
                <bi-input v-model="user" />
            </bi-form-item>
        </bi-form>
    </div>
</template>

<script>
export default{
    dialog:{
        title:'添加驱动'
    },
    data(){
        let fromOption = ['mysql','mssql','sqlte','自定义'];
        return  {
            user:'',
            from:'自定义',
            fromOption
        }
    },
    props:{
        has:Array
    },
    methods:{
        dialogOk(){
            let value = '';
            if (this.from == '自定义'){
               value = this.user;
            }else{
               value = this.from;
            }

            if (value==''){
                this.$alert('请输入值');
                return false;
            }

            if (this.has.indexOf(value) != -1){
                this.$alert('已经存在');
                return false;
            }

            this.dialog.callback(value,this.dialog);
            return true;
        }
    }
}
</script>